//
//  TestJSO/Users/zouzhisheng/Downloads/TestJSOC 2/TestJSOC.xcodeprojbject.m
//  TestJSOC
//
//  Created by 西游 on 7/25/15.
//  Copyright (c) 2015 com.xiyou. All rights reserved.
//

#import "TestJSObject.h"
#import "LoginViewController.h"
#import "AppDelegate.h"
#import "ProductInfoViewController1.h"
#import "RanViewController.h"
@implementation TestJSObject

//一下方法都是只是打了个log 等会看log 以及参数能对上就说明js调用了此处的iOS 原生方法
-(NSString*)getUserInfo
{
    NSString *useid;
    if (APP_CONTEXT.account.data.customer_id) {
        useid=APP_CONTEXT.account.data.customer_id;
    }else{
        useid=@"";
    }

    return useid;
}
-(void)toLogin{
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    UIViewController *ranVC=appDelegate.tabBarController.viewControllers[2];
    [LoginViewController presentLoginViewController:ranVC withCompleteBlock:^{
        
    }];

}
-(void)toProductDetail:(NSString *)message{
    RanViewController*ranVC=(RanViewController*)self.vcDelegate;
    [ranVC toProductDetail:message];
}
-(void)doShare:(NSString*)message{
  RanViewController*ranVC=(RanViewController*)self.vcDelegate;
    [ranVC shareAction:message];
    
}
-(void)goShoping{
    dispatch_async(dispatch_get_main_queue(), ^{
        AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
        UIButton *btn = [appDelegate.tabBarController.buttons objectAtIndex:0];
        [appDelegate.tabBarController selectedTab:btn];
        
    });

}
-(void)TestOneParameter:(NSString *)message
{
    NSLog(@"this is ios TestOneParameter=%@",message);
}
-(void)TestTowParameter:(NSString *)message1 SecondParameter:(NSString *)message2
{
   NSLog(@"this is ios TestTowParameter=%@  Second=%@",message1,message2);
}
@end
